package com.swfpeep.lang
{
	import flash.utils.Dictionary;

	public class LangDef
	{
		///导入语言文件
		include "zh.as"
		
		static private var _LANG_STRS:Dictionary;
		
		static public function initialize():void
		{
			var len:int = _LANG_ARR.length;
			
			_LANG_STRS = new Dictionary;
			for(var i:int = 0;i < len; i ++)
			{
				var arr_item:Array = _LANG_ARR[i];
				_LANG_STRS[arr_item[0]] = arr_item[1];
			}
		}
		
		static public function getLang():String
		{
			return _LANG_DEFAULT;
		}
		
		static public function str(...args):String
		{
			return str_array(args);
		}
		
		static public function str_array(args:Array):String
		{
			var len:int = args.length;
			var strs:String = "";
			
			for(var i:int = 0;i < len;i ++)
			{
				var key:String = args[i];
				
				if(key.indexOf("@") != -1)
				{
					strs += key.replace(/@/g,"")
				}
				else
					strs += _LANG_STRS[key];
			}
			
			return strs;
		}
	}
}